<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Authority Manager</title>
</head>
<body>
	<center>
		<form
			action="${pageContext.request.contextPath}/aclAuthority?method=getAuthorities" method="post">
			name:<input type="text" name="username" /> 
			<input type="submit" value="Submit" />
		</form>
		<br />
		<br />
		<c:if test="${!empty requestScope.user}">
			用户 <c:out value="${requestScope.user.username}" />的权限是:<br /><br />
			
			<form action="${pageContext.request.contextPath}/aclAuthority?method=updateAuthorities" method="post">
				<input type="hidden" name="username" value="${requestScope.user.username}" />

				<c:forEach items="${requestScope.authorities}" var="item">
					<c:set var="flag" value="false" />

					<c:forEach items="${requestScope.user.authorities}" var="ua">
						<c:if test="${item.url eq ua.url}">
							<c:set var="flag" value="true" />
						</c:if>
					</c:forEach>
					
					<input type="checkbox" name="authority" value="${item.url}"
						<c:if test="${flag}">checked="checked"</c:if> />${item.displayName}
				</c:forEach>
				
				<input type="submit" value="Update" />
			</form>
		</c:if>

	</center>
</body>
</html>